﻿@model List<iChip.Hotspots.Models.HotspotsObject>
@{
    ViewBag.Title = "GenMap";
}

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
        var markers = eval(@ViewBag.Arrhotspot);
        var markers = [[@Model[0].Hotspot_Address,@Model[0].Hotspot_Location.Split(',')[0],@Model[0].Hotspot_Location.Split(',')[1]]];
</script>
<script type="text/javascript">
    window.onload = function () {
        var mapOptions = {
            center: new google.maps.LatLng(markers[0][1], markers[0][2]),
            zoom: 15,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var infoWindow = new google.maps.InfoWindow();
        var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
        for (i = 0; i < markers.length; i++) {

            var data = markers[i]
            alert(data[0]);
            var myLatlng = new google.maps.LatLng(data[1], data[2]);
            var marker = new google.maps.Marker({
                position: myLatlng,
                map: map,
                title: data[0],
                icon: data[4]

            });


            (function (marker, data) {
                google.maps.event.addListener(marker, "click", function (e) {
                    infoWindow.setContent(data.description);
                    infoWindow.open(map, marker);
                });
            })(marker, data);
        }
    }
</script>

<div id="dvMap" style="width: 1189mm; height: 841mm">
</div>

